﻿
// The data store client side functions.
var DataStoreClientApi = new function ()
{
    // The url of the data store service.
    this.DataStoreServiceUrl = BrowserApi.ApplicationServicesUrl + "/DataStore/DataStoreService.aspx";

    /*
    Get the list of folders, and the number of sub folders in each folder.
    StartPath: The start path.
    OnGetFoldersCompleted : call the following function when the list is ready.    
    Sample results:
        OnGetFoldersCompleted('/',{
            1 : { 'FolderName' : 'Active Motion' , 'NumberOfSubFolders' : 6 },
            2 : { 'FolderName' : 'Applications' , 'NumberOfSubFolders' : 1 },
            3 : { 'FolderName' : 'Users' , 'NumberOfSubFolders' : 1 }
        });
    */
    this.GetFolders = function (StartPath, OnGetFoldersCompleted)
    {
        BrowserApi.LoadScript(this.DataStoreServiceUrl + "?FunctionName=GetFolders&StartPath=" + BrowserApi.UrlEncode(StartPath) + "&CallbackFunction=" + OnGetFoldersCompleted);
    }

    this.CreateFolder = function (FolderPath, OnCreateFolderCompleted)
    {
    }

    this.DeleteFolder = function (FolderPath, OnDeleteFolderCompleted)
    {
    }

    this.RenameFolder = function (OldFolderPath, NewFolderName, OnRenameFolderCompleted)
    {
    }

    this.LoadTextFile = function (FileName, OnLoadFileCompleted)
    {
    }

    this.SaveTextFile = function (FileName, TextContent, OnSaveFileCompleted)
    {
    }

    this.DeleteFile = function ()
    {
    }
}